<template>
	<Container>
		<view class="header">
			<view class="header-content" :style="{ background: 'url(' + assignment.backgroundUrl + ') 0 0 /100% 100%' }"><Article :articles="assignment.articles" /></view>
			<AudioIcon @iconTap="iconTap" :questionPress="questionPress" />
		</view>
		<Question :question="assignment.questionName" />
		<view :class="{ error: fails[0] }" hover-class="touch" hover-stay-time="100">
			<image class="box img" src="../../../static/yes.png" mode="widthFix" @tap="tap(true, 0)"></image>
		</view>
		<view :class="{ error: fails[1] }" hover-class="touch" hover-stay-time="100">
			<image class="box img" src="../../../static/no.png" mode="widthFix" @tap="tap(false, 1)"></image>
		</view>
	</Container>
</template>

<script>
import { mixins } from '../../../common/mixins/assignmentDefault.js'
import Article from '../article.vue'
import AudioIcon from '../audioIcon.vue'
import Question from '../questionName.vue'
import Container from '../container.vue'
export default {
	data() {
		return {
			fails: []
		}
	},
	mixins: [mixins],
	components: { Article, AudioIcon, Question, Container },
	methods: {
		tap: function(bool, index) {
			this.touchAudio()
			if (this.assignment.comparedArticle.isRight === bool) {
				this.$parent.next({
					isSure: true
				})
			} else {
				this.$set(this.fails, index, true)
				this.$parent.next()
			}
		}
	}
}
</script>

<style scoped lang="stylus">
.header
	height 46vh
	width 100%
	overflow hidden
	border-radius 70rpx
	border 12rpx solid #FCC77D
	box-sizing border-box
	transform translate3d(0, 0, 0)
	position relative
	margin 5vh 0
	.header-content
		position absolute
		height 100%
		width 1080rpx
		left 50%
		top 50%
		transform translate3d(-50%, -50%, 0)
		z-index 98
.box
	width 400rpx
	margin 3vh

</style>
